<template>
  <div id="app" :class="sideTheme === 'theme-dark' ? 'dark-theme' : ''">
    <router-view />
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'App',
  data(){
    return {
      title:''
    }
  },
  metaInfo() {
    return {
      title:this.title
     /*  title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
      titleTemplate: title => {
        return title ? `${title} - ${window.logoTitle}` : process.env.VUE_APP_TITLE
      } */
    }
  },
  computed: {
    sideTheme() {
      return this.$store.state.settings.sideTheme
    },
  },
  created(){
    this.$websocket.createSocket()
    // 注册监听事件
    window.addEventListener('onmessageWS', this.$websocket.getsocketData)
    this.getTitle();
  },
  beforeDestroy() {
    window.removeEventListener('onmessageWS', this.$websocket.getsocketData)
  },
  methods:{
    getTitle(){
      axios.get(window.baseUrl+'/system/theme/logoData').then(res=>{
          this.title=res.data.data.white.title
        });
    }
  },
}

</script>
